package top.eggcode.model;

import lombok.Data;
import top.eggcode.component.dict.Word;
import top.eggcode.base.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Table(name = "arm_app")
@Entity
@Data
public class App extends BaseEntity {
    /**
     * 应用名称
     */
    private String name;

    /**
     * 平均响应时间，ms
     */
    private Integer delay;

    /**
     * 运行状态
     */
    private Short status = 1;

    /**
     * 检测模式，http or 主动上报
     */
    @Word(dict = "app_check_mode")
    @Column(columnDefinition = "LONGTEXT")
    private Short mode;

    /**
     * 连接参数
     */
    private String params;

    /**
     * 报警开关
     * 0 不开启；1 开启
     */
    private Short alertEnable = 0;

    /**
     * 通知类型，1 短信 2 邮件 3 钉钉
     */
    private Short noticeType;

    private String noticeAddress;

    /**
     * 最后通知时间
     */
    private LocalDateTime lastNoticeTime = LocalDateTime.parse(
            "2000-01-01 00:00:00",
            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
    );
    ;

    private LocalDateTime lastCheckTime = LocalDateTime.parse(
            "2000-01-01 00:00:00",
            DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")
    );
}
